branchName="$(git symbolic-ref --short -q HEAD)"
userName="$(git config user.name)"

project_name="shb-pc-fe"

echo $project_name

status="构建"

if [ "$1" == "start" ]; then
    status="构建开始"
fi

if [ "$1" == "error" ]; then
    status="构建失败"
fi

if [ "$1" == "end" ]; then
    status="构建结束"
fi

curl 'https://oapi.dingtalk.com/robot/send?access_token=31b26a4297f4c66c17d0fed9cf277acce76d25b9fca2a17a60d9bc1979fcc69b' \
    -H 'Content-Type: application/json' \
    -d '{"msgtype": "text", 
        "text": {
            "content": "售后宝前端 '"${project_name}"' 项目 '"${userName}"' 在 '"${branchName}"' 分支 '"${status}"'"
        }
    }'